<%-- 
    Document   : register
    Created on : 16.4.2009, 23:03:31
    Author     : Ediczech
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<f:view>
    <%@include file="view/header.jsp" %>

    <%-- Content --%>

    <h2><h:outputText value="#{msg.registerUser_title}"/></h2>

    <a4j:form ajaxSubmit="true" reRender="RegisterUserPanel" id="RegisterUser" prependId="">
        <a4j:outputPanel ajaxRendered="true" id="RegisterUserPanel">
            <h:panelGrid columns="3">

                <h:outputText value="#{msg.registerUser_nickname}:" />
                <h:inputText id="Nickname" value="#{RegisterUserBean.user.nick}" size="15"
                             required="true" validator="#{RegisterUserBean.usernameValidator}">
                    <f:validateLength minimum="3" maximum="12"/>
                </h:inputText>
                <h:message for="Nickname" errorClass="message_error"/>

                <h:outputText value="#{msg.registerUser_firstname}:" />
                <h:inputText id="Firstname" value="#{RegisterUserBean.user.firstname}"
                             size="15" required="true">
                    <f:validateLength minimum="3" maximum="20"/>
                </h:inputText>
                <h:message for="Firstname" errorClass="message_error"/>

                <h:outputText value="#{msg.registerUser_lastname}:" />
                <h:inputText id="Lastname" value="#{RegisterUserBean.user.lastname}"
                             size="15" required="true">
                    <f:validateLength minimum="3" maximum="30"/>
                </h:inputText>
                <h:message for="Lastname" errorClass="message_error"/>

                <h:outputText value="#{msg.registerUser_password}:" />
                <h:inputSecret id="Password" value="#{RegisterUserBean.user.password}"
                               size="15" required="true">
                    <f:validateLength minimum="4" maximum="30"/>
                </h:inputSecret>
                <h:message for="Password" errorClass="message_error"/>

                <h:outputText value="#{msg.registerUser_passCheck}:" />
                <h:inputSecret id="PassCheck" value="#{RegisterUserBean.password}"
                               size="15" required="true">
                    <f:validateLength minimum="4" maximum="30"/>
                    <f:validator validatorId="passwordValidator"/>
                    <f:attribute name="passwordId" value="RegisterUser:Password" />
                </h:inputSecret>
                <h:message for="PassCheck" errorClass="message_error"/>

                <h:outputText value="#{msg.registerUser_email}:" />
                <h:inputText id="Email" value="#{RegisterUserBean.user.email}"
                             size="15" required="true">
                    <f:validator validatorId="emailValidator"/>
                </h:inputText>
                <h:message for="Email" errorClass="message_error"/>
            </h:panelGrid>
            
            <h:panelGrid>
                <h:messages errorClass="message_error" globalOnly="true"/>
                <h:commandButton action="#{RegisterUserBean.register}" value="#{msg.registerUser_button}"/>
            </h:panelGrid>
        </a4j:outputPanel>
    </a4j:form>

    <%-- Content --%>

    <%@include file="view/footer.jsp" %>
</f:view>